<!--
 * @Description:分类秒杀
 * @version: v1.0
 * @Author: Wang Xi
 * @Date: 2023-5-16 10:10:00
 * @LastEditors: WangXi
 * @LastEditTime: 2023-06-15 10:31:20
-->
<template>
	<view class="classify-seckill-container">
		<c-layout>
			<c-navigation-bar slot="head" :bgColor='true' navType="search" :disabled='false' :title="title" navPlaceholder="  ..."
				navThmen=line>
			</c-navigation-bar>
			<view class="container-box">
			
				<view class="classify-seckill-card">
					<!-- <text> {{$t("classifySeckill.AllCategories")}}</text> -->
					<text> {{$t("classifySeckill.subclassification")}}</text>

					<view class="card-main">
						<view class="" v-for="(item,index) in categoriesList" :key="item.id" @click="typeClick(item,index)">
							<view class="text">
								<h2>{{item.name}}</h2>
								<p>{{item.des}}</p>
							</view>
							<view class="image-box">
								<image style="height: 100%; width: 100%;" :src="$u.file.getMedieUrl(item.image)" mode="center"></image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</c-layout>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				typeList: [],
				title: '',
				categoriesList: []
			};
		},
		onLoad(val) {
			this.$u.get('/app/shopGoodsInfo/categoryAll').then((res) => {
			res.data.forEach(i=>{
				if(i.id==val.id){
						this.categoriesList = i.child
						this.title=i.name
				}
			})
				
			
			})
		},
		methods: {
			getCategory() {
				
			},
			searchEvent() {},
			// 点击父级类型
			parentClick(item) {
				this.categoriesList = item.child
				this.nowId = item.id
			},
			// 类型点击
			typeClick({
				id,
				name

			}, index) {
				console.log(id, name);
				if (name == 'more') {
					uni.navigateTo({
						url: "/pages/filterMenu/filterMenu"
					})
					return
				}
				uni.navigateTo({
					url: "/pages/goodsForClassify/goodsForClassify?id=" + id + '&name=' + name + '&index=' + index
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.classify-seckill-container {
		font-family: SFUIDisplay-Regular-Regular, SFUIDisplay-Regular;
		/deep/ .search-jump {
			.uni-input-placeholder {
				color: #1B1D29;
			}
		}

		.isCheked {
			background: rgba(41, 52, 208, 1);
			color: #fff;
			padding:0 10px;
			border-radius: 10px;
		}

		.container-box {

			.classify-seckill-circle,
			.classify-seckill-card {
				>text {
					color: #1B1D29;
					font-size: 52rpx;
					line-height: 78rpx;
					display: block;
					margin-bottom: 50rpx;
				}

			}

			.classify-seckill-circle {
				.circle-main {
					display: flex;
					justify-content: flex-start;
					flex-wrap: wrap;

					.type {
						display: inline-block;
						width: 220rpx;
						margin-right: 20rpx;
						text-align: center;

						p {
							overflow: hidden;
							white-space: nowrap;
							text-overflow: ellipsis;
							-o-text-overflow: ellipsis;

						}
					}

					>view {
						text-align: center;
						margin-bottom: 40rpx;
						width: calc((100%) / 3);
						display: flex;
						flex-direction: column;
						align-items: center;

						>.image-box {
							border: 4rpx solid #ccc;
							border-radius: 50%;
							padding: 10rpx;
							width: 120rpx;
							height: 120rpx;

							>image {
								display: block;
							}

							>.more-box {
								width: 100%;
								height: 100%;
								display: flex;
								align-items: center;
								justify-content: center;
								font-size: 80rpx;
								color: #C1C2C4;
								background-color: #F2F3F5;
								border-radius: 50%;
							}
						}


					}

				}
			}

			.classify-seckill-card {
				margin-top: 36rpx;

				.card-main {
					overflow: hidden;

					>view {
						height: 160rpx;
						width: 100%;
						display: flex;
						align-items: center;
						background-color: #F6F9FA;
						border-radius: 16rpx;
						// &:not(:first-child){
						margin-bottom: 30rpx;

						// }
						.text {
							flex: auto;
							width: 0;
							margin: 40rpx 0rpx 0rpx 40rpx;

							>h2 {
								font-size: 34rpx;
							}

							>p {
								width: 100%;
								font-size: 20rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
								margin-top: 16rpx;
							}
						}

						.image-box {
							height: 95%;
							width: 240rpx;

							>img {
								height: 95%;
							}
						}

					}
				}
			}
		}
	}
</style>